<template>
  <div>
    <el-menu
      style="width: 200px;min-height: calc(100vh - 50px); overflow-x: hidden;height:100%"
      :default-active="path"
      router
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      
    >
      <el-menu-item index="/index">
        <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-shouye"></use>
          </svg>
        <template #title>首页</template>
      </el-menu-item>
      <el-sub-menu index="0" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-yonghuquanxian1"></use>
          </svg>
          <span>权限管理</span>
        </template>
        <el-menu-item index="/authority">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-yonghuquanxian"></use>
            </svg>
            <span>用户信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="9" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiaoshiguanli1"></use>
          </svg>
          <span>班主任信息管理</span>
        </template>
        <el-menu-item index="/headmasterinfo">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-jiaosebanzhurenjihuo"></use>
            </svg>
            <span>班主任信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="1" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiaoshiguanli"></use>
          </svg>
          <span>教师信息管理</span>
        </template>
        <el-menu-item index="/teacher">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-laoshi"></use>
            </svg>
            <span>教师信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="2" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-GroupCopy"></use>
          </svg>
          <span>学生信息管理</span>
        </template>
        <el-menu-item index="/student">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xuesheng"></use>
            </svg>
            <span>学生信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="3" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-basic-information_line"></use>
          </svg>
          <span>基础信息管理</span>
        </template>
        <el-menu-item index="/grade">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-nianjibanji"></use>
            </svg>
            <span>年级管理</span>
          </template>
        </el-menu-item>
        <el-menu-item index="/clazz">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-banji"></use>
            </svg>
            <span>班级管理</span>
          </template>
        </el-menu-item>
        <el-menu-item index="/course">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-kechengguanli"></use>
            </svg>
            <span>课程管理</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="4" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-chengjiguanli-01"></use>
          </svg>
          <span>成绩信息管理</span>
        </template>
        <el-menu-item index="examlist">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-kaoshi"></use>
            </svg>
            <span>考试列表</span>
          </template>
        </el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="5" v-if="user.type === 2">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiaoxueguanli"></use>
          </svg>
          <span>教学管理</span>
        </template>
        <el-menu-item index="/teaching">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-icon_luruchenji"></use>
            </svg>
            <span>登记成绩</span>
          </template>
        </el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="8" v-if="user.type === 2">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-gerenxinxi"></use>
          </svg>
          <span>信息管理</span>
        </template>
        <el-menu-item index="/teacherinfo">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-gerenxinxi_o"></use>
            </svg>
            <span>个人信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="6" v-if="user.type === 3">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-kaoshixinxi"></use>
          </svg>
          <span>成绩管理</span>
        </template>
        <el-menu-item index="/studnet_score">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-chengji-"></use>
            </svg>
            <span>查看成绩</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="7" v-if="user.type === 3">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-gerenxinxi"></use>
          </svg>
          <span>信息管理</span>
        </template>
        <el-menu-item index="/studentinfo">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-gerenxinxi_o"></use>
            </svg>
            <span>个人信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="0" v-if="user.type === 4">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiaoshiguanli"></use>
          </svg>
          <span>信息管理</span>
        </template>
        <el-menu-item index="/headmasterstudentinfo">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xuesheng"></use>
            </svg>
            <span>学生信息</span>
          </template>
        </el-menu-item>
      </el-sub-menu>

      <!-- <el-sub-menu index="15" v-if="user.type === 1">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jiaoshiguanli"></use>
          </svg>
          <span>测试</span>
        </template>
        <el-menu-item index="/test">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xuesheng"></use>
            </svg>
            <span>测试</span>
          </template>
        </el-menu-item>
      </el-sub-menu> -->

      <el-sub-menu index="2" v-if="user.type === 4">
        <template #title>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-kaoshixinxi"></use>
          </svg>
          <span>考试信息</span>
        </template>
        <el-menu-item index="/headmasterstudentexamlist">
          <template #title>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-chengji-"></use>
            </svg>
            <span>考试列表</span>
          </template>
        </el-menu-item>
      </el-sub-menu>
    </el-menu>
  </div>
</template>
<script>
export default {
  name: "Aside",
  data() {
    return {
      user: {},
      path: this.$route.path,
    };
  },
  created() {
    let str = sessionStorage.getItem("user") || "{}"
      this.user = JSON.parse(str)
      console.log(this.user);
  },
};
</script>
<style scoped>
</style>